package pt.um.jspecput.lib.writer;

import static pt.um.jspecput.util.Constants.*;

import java.io.IOException;
import java.io.Writer;

/**
 * The Class TestMethodWriterHelper holds methods to write JUnit test methods.
 */
public class TestMethodWriterHelper extends MethodWriterHelper {

    /**
     * Open method declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param access
     *            the access level of the method
     * @param returnType
     *            the return type of the method
     * @param methodName
     *            the name of the method
     * @param args
     *            the argument list
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openMethodDeclaration(Writer writer, String access,
            String returnType, String methodName, String[] args)
            throws IOException {
        writer.write(TEST_ANNOTATION);
        writer.write(INVOCATION_COUNT_ANNOTATION);
        MethodWriterHelper.openMethodDeclaration(writer, access, returnType,
                methodName, args);
    }

    /**
     * Open public method declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param returnType
     *            the return type of the method
     * @param methodName
     *            the name of the method
     * @param args
     *            the argument list
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openPublicMethodDeclaration(Writer writer,
            String returnType, String methodName, String[] args)
            throws IOException {
        writer.write(TEST_ANNOTATION);
        writer.write(INVOCATION_COUNT_ANNOTATION);
        MethodWriterHelper.openPublicMethodDeclaration(writer, returnType,
                methodName, args);
    }

    /**
     * Open private method declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param returnType
     *            the return type of the method
     * @param methodName
     *            the name of the method
     * @param args
     *            the argument list
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openPrivateMethodDeclaration(Writer writer,
            String returnType, String methodName, String[] args)
            throws IOException {
        writer.write(TEST_ANNOTATION);
        writer.write(INVOCATION_COUNT_ANNOTATION);
        MethodWriterHelper.openPrivateMethodDeclaration(writer, returnType,
                methodName, args);
    }

    /**
     * Open protected method declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param returnType
     *            the return type of the method
     * @param methodName
     *            the name of the method
     * @param args
     *            the argument list
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openProtectedMethodDeclaration(Writer writer,
            String returnType, String methodName, String[] args)
            throws IOException {
        writer.write(TEST_ANNOTATION);
        writer.write(INVOCATION_COUNT_ANNOTATION);
        MethodWriterHelper.openProtectedMethodDeclaration(writer, returnType,
                methodName, args);
    }

    /**
     * Open nothing method declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param returnType
     *            the return type of the method
     * @param methodName
     *            the name of the method
     * @param args
     *            the argument list
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openNothingMethodDeclaration(Writer writer,
            String returnType, String methodName, String[] args)
            throws IOException {
        writer.write(TEST_ANNOTATION);
        writer.write(INVOCATION_COUNT_ANNOTATION);
        MethodWriterHelper.openNothingMethodDeclaration(writer, returnType,
                methodName, args);
    }
}
